// ignore_for_file: file_names, prefer_collection_literals

import 'package:time_manager/utils/timeDeal.dart';

class RecoreModel {
  late String dealtime; // 日程执行时间
  late String title; // 日程内容
  late String status; // 1表示未完成  2表示已完成
  late String duration;
  int? id;
  String? createTime; // 创建时间

  RecoreModel(
      {required this.title,
      required this.status,
      required this.duration,
      required this.dealtime,
      this.id,
      this.createTime});

  RecoreModel.fromJson(Map<String, dynamic> json) {
    title = json['title'];
    status = json['status'];
    duration = json['duration'];
    dealtime = json['dealtime'];
    createTime = json['createTime'] ?? TimeUtil().getTimeStamp();
  }

  RecoreModel.fromSql(Map<String, dynamic> json) {
    title = json['title'];
    id = json['id'];
    status = json['status'];
    duration = json['duration'];
    dealtime = json['dealtime'];
    createTime = json['createTime'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = Map<String, dynamic>();

    data['title'] = title;
    data['status'] = status;
    data['duration'] = duration;
    data['dealtime'] = dealtime;
    data['id'] = id;
    data['createTime'] = createTime ?? TimeUtil().getTimeStamp();
    return data;
  }
}
